package getProperties;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class Main {
    public static void main(String[] args) throws IOException {
        //读取英文配置
        InputStream englishIs = Main.class.getClassLoader().getResourceAsStream("english.properties");
        Properties englishProperties = new Properties();
        englishProperties.load(englishIs);
        String e_heart = englishProperties.getProperty("my.heart");
        String e_iis = englishProperties.getProperty("my.is");
        String e_magic = englishProperties.getProperty("my.magic");
        System.out.println(e_heart);
        System.out.println(e_iis);
        System.out.println(e_magic);
        System.out.println("========================================");
        //读取中文配置
        InputStream chineseIs = Main.class.getClassLoader().getResourceAsStream("chinese.properties");
        Properties chineseProperties = new Properties();
        //使用GBK编码
        chineseProperties.load(new InputStreamReader(chineseIs,"GBK") {
        });
        String c_heart = chineseProperties.getProperty("my.heart");
        String c_iis = chineseProperties.getProperty("my.is");
        String c_magic = chineseProperties.getProperty("my.magic");
        System.out.println(c_heart);
        System.out.println(c_iis);
        System.out.println(c_magic);
    }
}
